package com.example.module.shoppingCart.DO;


import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import java.util.Date;

/**
 * @author ghy
 * @date 2025/08/28
 * @description 购物车添加DO
 */
@Data
@Entity
@Table(name = "shoppingcart")
@Validated
public class ShoppingCartAddDO {
    /*
     * 购物车Id
     * */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "shopping_cart_id")
    @NotBlank(message = "购物车ID不能为空")
    private Long shoppingCartId;

    /*
     * 用户Id
     * */
    @Column(name = "user_id")
    @NotBlank(message = "用户ID不能为空")
    private Long userId;

    /*
     * 商品Id
     * */
    @Column(name = "goods_id")
    @NotBlank(message = "商品ID不能为空")
    private Long goodsId;
    /*
     * 加入购物车时间
     * */
    @Column(name = "shopping_add_time")
    @NotBlank(message = "加入购物车时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date shoppingAddTime;

    /*
     * Getter and Setter
     * */

    public @NotBlank(message = "购物车ID不能为空") Long getShoppingCartId() {
        return shoppingCartId;
    }

    public void setShoppingCartId(@NotBlank(message = "购物车ID不能为空") Long shoppingCartId) {
        this.shoppingCartId = shoppingCartId;
    }

    public @NotBlank(message = "用户ID不能为空") Long getUserId() {
        return userId;
    }

    public void setUserId(@NotBlank(message = "用户ID不能为空") Long userId) {
        this.userId = userId;
    }

    public @NotBlank(message = "商品ID不能为空") Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(@NotBlank(message = "商品ID不能为空") Long goodsId) {
        this.goodsId = goodsId;
    }

    public @NotBlank(message = "加入购物车时间不能为空") Date getShoppingAddTime() {
        return shoppingAddTime;
    }

    public void setShoppingAddTime(@NotBlank(message = "加入购物车时间不能为空") Date shoppingAddTime) {
        this.shoppingAddTime = shoppingAddTime;
    }
}
